import re

# version2.0
# 为提高效率／减少错误率，将正则换为if判断
# 代码精减，便于维护

def phone():
    n = input("请输入一个手机号：")
    l_t = ['130','131','132','155','156','185','186','145','176']
    y_d = ['134', '135' , '136', '137', '138', '139', '147', '150', '151',
           '152', '157', '158', '159', '178', '182', '183', '184', '187', '188']
    d_x = ['133','153','189']

    if re.match(r'1[3,4,5,7,8]\d{9}',n):
        print("您输入的的手机号码是：\n",n)
        if n[0:3] in l_t:
            print("该号码属于：中国联通")
        elif n[0:3] in y_d:
            print("该号码属于：中国移动")
        else:
            print("该号码属于：中国电信")
    else:
        print("请输入正确的手机号")

if __name__ == '__main__':
    phone()